using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HeroScript : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        //获取collider组件
        var collider = GetComponent<Collider2D>();
        collider.isTrigger = true;
    }

    // Update is called once per frame
    void Update()
    {

    }
    public Vector3 GetPosition()
    {
        return transform.position;
    }

    void OnTriggerEnter2D(Collider2D other)
    {
        // 示例代码：打印信息并可能执行其他逻辑
        Debug.LogFormat("Object {0} has entered the trigger!", other.gameObject.name);

        // 根据需要进行进一步的逻辑处理，比如交换数据、播放动画或更改状态等
    }
}
